#include #include #include using namespace std; bool isEven(int n) { bool result = true; if(n%2 != 0) { result = false; } return result; } bool isOdd(int n) { return !isEven(n); } int absoluteValue(int n) { int result = n; if(n < 0) { result = result * -1; } return result; } bool isLeapYear(int year) { bool result = false; if(year % 4 == 0) { if(year%100 == 0) { if(year%400 == 0) { result = true; } } else { result = true; } } return result; } bool isValidDate(int year, int month, int day) { bool result = false; if(month >=1 && month <=12) { switch(month) { case 9: case 4: case 6: case 11: if(day >= 1 && day <= 30) { result = true; } break; case 2: if(isLeapYear(year) && day >= 1 && day <= 29) { result = true; } else if (day >= 1 && day <= 28) { result = true; } break; default: if(day >= 1 && day <= 31) { result = true; } break; } } return result; } void main() { for(int i = 0; i < 100;i++) { if(isOdd(i)) { cout << i << " is even " << endl; } } if(isValidDate(2000, 1, 32)) { cout << "Yes" << endl; } int x; cin >> x; cout << absoluteValue(x) << endl; cout << abs(-99) << endl; cout << sin(3.14) << endl; }